#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>

using namespace std;

int findPoisonedDuration(const vector<int>& timeSeries, int duration) {
    int ret = duration;

    for (int i = 1; i < timeSeries.size(); ++i)
    {
        if (timeSeries[i] - duration <= timeSeries[i - 1])
        {
            ret += duration - (timeSeries[i] - timeSeries[i - 1]);
        }
        else
        {
            ret += duration;
        }

        int temp = timeSeries[i] - timeSeries[i - 1];
        if (temp >= duration)
            ret += duration;
        else
            ret += temp;
    }

    return ret;
}

int main()
{
    findPoisonedDuration({ 1,2,3,4,5,6,7,8,9 } , 1);

	return 0;
}